<template>
  <div class="boxInfo">
    <!-- 表单内容 -->
    <div class="formInfo">
      <div>
        <!-- 头部信息  -->
        <div class="userInfo">
             <div class="headInfo clearfix">
               <div class="headText">
                 <el-form ref="formData" label-width="215px">
                     <el-form-item label="手机号：">
                       <el-input v-model="userInfo.phone" placeholder="手机号" class="inputW" disabled></el-input>
                     </el-form-item>
                     <el-form-item label="密码：">
                       <el-input v-model="userInfo.password" type="password" placeholder="请输入" class="inputW"></el-input>
                    </el-form-item>
                    <el-form-item>
                      <template slot-scope="scope">
                        <el-button type="primary" @click="updatePassword(userInfo.id,userInfo.name)">重置密码</el-button>
                        <router-link :to="{'path':'/system/department'}" class="el-button el-button--text el-button--small">
                          取消
                        </router-link>
                      </template>
                    </el-form-item>
                 </el-form>
               </div>
             </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {resetPassword} from '@/api/user'
export default {
  name: 'accountInfo',
  props: ['userInfo'],
  data() {
    return {

    }
  },
  methods: {
    updatePassword(id,name){
      this.$confirm('是否重置{'+name+'}用户密码', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        resetPassword(id).then(res => {
          if(res.data){
            this.$message({
              message: '重置成功',
              type: 'success'
            });
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        });
      });
    }
  },
  // 创建完毕状态
  created: function() {

  }
}
</script>

<style rel="stylesheet/scss" lang="scss">
.el-collapse-item__arrow {
  float: left;
}

.el-collapse-item {
  position: relative;
  .infoR {
    position: absolute;
    background: #fff;
    display: inline-block;
    width: 100px;
    height: 35px;
    line-height: 35px;
    text-align: right;
    right: -100px;
    top: 0px;
  }
}
.linkage {
  display: inline-block;
}
.textBotm {
  vertical-align: text-bottom;
}
.navInfo {
  height: auto;
  font-size: 30px;
  color: #333;
  background-color: #e4e4e4;
  text-align: center;
  border-bottom: 1px solid #333;
}
.step {
  position: fixed;
  left: 220px;
  top: 50%;
  margin-top: -150px;
  background: #fff;
  z-index: 9;
}
</style>

<style rel="stylesheet/scss" lang="scss" scoped>
</style>
